package com.yimi.yinhepda.adapter.RecycleAdapter

import android.content.Context
import com.yimi.yinhepda.R
import com.pda.ym.base.CommonRecycleAdapter
import com.pda.ym.base.CommonViewHolder
import com.yimi.yinhepda.entity.bean.KuaYueChildWaybillEntitiy

/**
 * @author: lj
 * Date: 2020/3/9 14:28
 * Description:跨越差异报告列表适配器
 */
class KuaYueDifferChildWaybillAdapter(var context: Context?, dataList: MutableList<KuaYueChildWaybillEntitiy>?)
    : CommonRecycleAdapter<KuaYueChildWaybillEntitiy>(context, dataList, R.layout.item_kuayue_differ_child) {

    override fun bindData(holder: CommonViewHolder?, data: KuaYueChildWaybillEntitiy?, position: Int) {
        holder?.setText(R.id.tv_childWaybill, data?.subOutsideNo)
        holder?.setText(R.id.tv_type, data?.exceptionType)
        when (data?.exceptionType) {
            "少货" -> {
                holder?.itemView?.setBackgroundColor(context!!.resources.getColor(R.color.red))
            }
            "多货" -> {
                holder?.itemView?.setBackgroundColor(context!!.resources.getColor(R.color.yellow))
            }
            else -> {
                holder?.itemView?.setBackgroundColor(context!!.resources.getColor(R.color.white))
            }
        }
    }
}